#include "HiranipraCommon.h"

#include "Net/NetClient.h"

#ifndef _CLIENT_APP_H_
#define _CLIENT_APP_H_

namespace Hiranipra {
	namespace Client {
		using namespace Hiranipra::HCM;
		using namespace Hiranipra::Net;
		using namespace Hiranipra::Platform;
		using namespace Hiranipra::Platform::Graphics;
		using namespace Hiranipra::Platform::IO;

		class ClientApp
		{
		public:
			ClientApp();
			~ClientApp();
			bool RegisterAssembly( wstring path );
			int Start( wstring appPath, vector<wstring> args );

		public:
			FORCE_INLINE IApplication*		GetApplication() const { return _app; }
			FORCE_INLINE IFileSystem*		GetFileSystem() const { return _fs; }
			FORCE_INLINE IGraphicsSystem*	GetGraphicsSystem() const { return _graphics; }
			FORCE_INLINE IOQueue*			GetIOQueue() const { return _ioQueue; }
			FORCE_INLINE NetClient*			GetNetClient() const { return _netClient; }

		private:
			class MainRunner; friend class MainRunner;
			class WindowRunner; friend class WindowRunner;
			class NetworkRunner; friend class NetworkRunner;

			ComponentRegistry	_hcmRegistry;
			IApplication*		_app;
			IFileSystem*		_fs;
			IGraphicsSystem*	_graphics;
			IGraphicsDevice*	_device;

			IOQueue*			_ioQueue;

			FastMutex			_windowLock;
			IWindow*			_mainWindow;
			vector<IWindow*>	_windows;

			NetClient*			_netClient;
		};

	}
}

#endif // _CLIENT_APP_H_
